<?php

/*
Plugin Name: jCart
Plugin URI: http://conceptlogic.com/jcart/
Description: <strong>BETA version!</strong> Ajax shopping cart with PayPal checkout. Easy to customize with your text and CSS. Based on jCart version 1.2.
Author: Doug Whitney
Version: 0.9.1
Author URI: http://conceptlogic.com
*/


// SET THE DEFAULT VALUES USED IN THE DEMO STORE TEMPLATE
if (!get_option('jcart_item_id')) {update_option('jcart_item_id', 'my-item-id');}
if (!get_option('jcart_item_name'))	{update_option('jcart_item_name', 'my-item-name');}
if (!get_option('jcart_item_price')) {update_option('jcart_item_price', 'my-item-price');}
if (!get_option('jcart_item_qty')) {update_option('jcart_item_qty', 'my-item-qty');}
if (!get_option('jcart_item_add')) {update_option('jcart_item_add', 'my-add-button');}


// PRE-2.6 COMPATIBILITY
if (!defined('WP_CONTENT_URL'))
	{
	define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
	}

if (!defined('WP_CONTENT_DIR'))
	{
	define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
	}

if (!defined('WP_PLUGIN_URL'))
	{
	define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins');
	}

if (!defined('WP_PLUGIN_DIR'))
	{
	define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
	}


// ADD JCART MENU ITEM TO WP ADMIN MENU
add_action('admin_menu', 'jcart_menu_item');

// ADD JCART ADMIN CSS TO WP ADMIN HTML HEAD
add_action('admin_head', 'admin_css');

// ADD JCART JAVASCRIPTS TO WP GLOBAL SCRIPTS
add_action('wp_print_scripts', 'jcart_scripts');

// ADD JCART FRONT END CSS TO WP FRONT END HTML HEAD
add_action('wp_head', 'jcart_css');


// JCART ADMIN MENU ITEM
function jcart_menu_item()
	{
	add_options_page('jCart Settings', 'jCart', 1, __FILE__, 'jcart_options');
	}


// JCART ADMIN CSS
function admin_css()
	{
	$is_jcart_options_page = strpos($_SERVER['REQUEST_URI'], 'jcart');

	if ($is_jcart_options_page !== false)
		{
		echo '<link rel="stylesheet" type="text/css" media="screen, projection" href="' . WP_PLUGIN_URL . '/jcart/jcart-admin.css" />' . "\n";
		echo '<link rel="stylesheet" type="text/css" media="screen, projection" href="' . get_option('siteurl') . '/wp-includes/js/thickbox/thickbox.css" />' . "\n";
		}
	}


// JCART JAVASCRIPTS
function jcart_scripts()
	{
	// FRONT END
	if (!is_admin())
		{
		// JCART NEEDS JQUERY 1.3.2 BUT WORDPRESS (2.7.1) CURRENTLY INCLUDES JQUERY 1.2.6
		// DE-REGISTER JQUERY IF ALREADY IN USE
		wp_deregister_script('jquery');

		// QUE UP JQUERY 1.3.2 VIA GOOGLE AJAX APIs
		wp_enqueue_script('jquery', WP_PLUGIN_URL . '/jcart/jquery-1.3.2.min.js', false, '1.3.2');

		// QUE UP JCART 1.2
		wp_enqueue_script('jcart', WP_PLUGIN_URL . '/jcart/jcart-javascript.php', array('jquery'), '1.2');
		}
	// ADMIN
	else if (is_admin())
		{
		$is_jcart_options_page = strpos($_SERVER['REQUEST_URI'], 'jcart');

		if ($is_jcart_options_page !== false)
			{
			wp_enqueue_script('thickbox', get_option('siteurl') . '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '');
			}
		}
	}


// JCART FRONT END CSS
function jcart_css()
	{
	if (!is_admin())
		{
    	echo '<link rel="stylesheet" type="text/css" media="screen, projection" href="' . WP_PLUGIN_URL . '/jcart/jcart.css" />' . "\n";
    	}
	}


// PROCESS AND OUTPUT JCART
// ASSUMING THE CHECKOUT PAGE USES A GLOBAL SIDEBAR, THIS FUNCTION WILL BE CALLED TWICE ON THE CHECKOUT PAGE
// THE LOCATION PARAMETER ALLOWS JCART TO DETERMINE WHERE IT IS BEING INCLUDED, SO THE CART IS NOT DISPLAYED TWICE
function wp_jcart($display_location)
	{
	// DETERMINE IF THIS IS THE CHECKOUT PAGE
	$is_checkout = strpos($_SERVER['REQUEST_URI'], get_option('jcart_form_action'));
	if ($is_checkout !== false || $_REQUEST['jcart_is_checkout'] == 'true')
		{
		$is_checkout = true;
		}
	else
		{
		$is_checkout = false;
		}

	// IF THIS IS THE CHECKOUT, OR IF THIS IS THE SIDEBAR AND NOT THE CHECKOUT
	if ($display_location == 'content' || ($display_location == 'sidebar' && $is_checkout !== true))
		{
		// RENDER JCART
		include_once('jcart.php');

		@session_start();

		// INITIALIZE JCART AFTER SESSION START
		$cart =& $_SESSION["jcart"]; if(!is_object($cart)) $cart = new jcart();

		// DEFAULT CONFIG VALUES
		include('jcart-defaults.php');

		$cart->display_cart($jcart);
		}
	}


// JCART ADMIN OPTIONS
function jcart_options()
	{

	// IF OPTIONS HAVE BEEN UPDATED
	if($_POST['jcart-options-post'] == 'Y')
		{
		// CHECK NONCE
		check_admin_referer( 'jcart-update-admin-options');

		// ADD-TO-CART FORM FIELD NAME ATTRIBUTES
		$jcart['item_id']                   = $_POST['jcart-item-id'];
		$jcart['item_name']                 = $_POST['jcart-item-name'];
		$jcart['item_price']                = $_POST['jcart-item-price'];
		$jcart['item_qty']                  = $_POST['jcart-item-qty'];
		$jcart['item_add']                  = $_POST['jcart-item-add'];

		// CHECKOUT PAGE
		$jcart['form_action']               = $_POST['jcart-form-action'];

		// PAYPAL SETUP
		$jcart['paypal_id']                 = $_POST['jcart-paypal-id'];
		$jcart['paypal_currency']           = $_POST['jcart-paypal-currency'];

		// DISPLAY TEXT
		$jcart['cart_title']                = $_POST['jcart-cart-title'];
		$jcart['single_item']               = $_POST['jcart-single-item'];
		$jcart['multiple_items']            = $_POST['jcart-multiple-items'];
		$jcart['subtotal']                  = $_POST['jcart-subtotal'];

		$jcart['update_button']             = $_POST['jcart-update-button'];
		$jcart['checkout_button']           = $_POST['jcart-checkout-button'];
		$jcart['checkout_paypal_button']    = $_POST['jcart-checkout-paypal-button'];
		$jcart['remove_link']               = $_POST['jcart-remove-link'];
		$jcart['empty_button']              = $_POST['jcart-empty-button'];
		$jcart['empty_message']             = $_POST['jcart-empty-message'];
		$jcart['item_added_message']        = $_POST['jcart-item-added-message'];

		$jcart['price_error']               = $_POST['jcart-price-error'];
		$jcart['qty_error']                 = $_POST['jcart-qty-error'];
		$jcart['checkout_error']            = $_POST['jcart-checkout-error'];

		// IMAGE BUTTONS
		$jcart['update_image']              = $_POST['jcart-update-image'];
		$jcart['empty_image']               = $_POST['jcart-empty-image'];
		$jcart['checkout_image']            = $_POST['jcart-checkout-image'];
		$jcart['checkout_paypal_image']     = $_POST['jcart-checkout-paypal-image'];


		// UPDATE OPTIONS
		update_option('jcart_item_id', $jcart['item_id']);
		update_option('jcart_item_name', $jcart['item_name']);
		update_option('jcart_item_price', $jcart['item_price']);
		update_option('jcart_item_qty', $jcart['item_qty']);
		update_option('jcart_item_add', $jcart['item_add']);

		update_option('jcart_form_action', $jcart['form_action']);

		update_option('jcart_paypal_id', $jcart['paypal_id']);
		update_option('jcart_paypal_currency', $jcart['paypal_currency']);

		update_option('jcart_cart_title', $jcart['cart_title']);
		update_option('jcart_single_item', $jcart['single_item']);
		update_option('jcart_multiple_items', $jcart['multiple_items']);
		update_option('jcart_subtotal', $jcart['subtotal']);

		update_option('jcart_update_button', $jcart['update_button']);
		update_option('jcart_checkout_button', $jcart['checkout_button']);
		update_option('jcart_checkout_paypal_button', $jcart['checkout_paypal_button']);
		update_option('jcart_remove_link', $jcart['remove_link']);
		update_option('jcart_empty_button', $jcart['empty_button']);
		update_option('jcart_empty_message', $jcart['empty_message']);
		update_option('jcart_item_added_message', $jcart['item_added_message']);

		update_option('jcart_price_error', $jcart['price_error']);
		update_option('jcart_qty_error', $jcart['qty_error']);
		update_option('jcart_checkout_error', $jcart['checkout_error']);

		update_option('jcart_update_image', $jcart['update_image']);
		update_option('jcart_empty_image', $jcart['empty_image']);
		update_option('jcart_checkout_image', $jcart['checkout_image']);
		update_option('jcart_checkout_paypal_image', $jcart['checkout_paypal_image']);

?>
		<div class="updated"><p><strong><?php _e('Options saved.'); ?></strong></p></div>
<?php
		}
	// NORMAL PAGE DISPLAY
	else
		{
		// FORM INPUT NAME ATTRIBUTE VALUES
		$jcart['item_id']                   = get_option('jcart_item_id');
		$jcart['item_name']                 = get_option('jcart_item_name');
		$jcart['item_price']                = get_option('jcart_item_price');
		$jcart['item_qty']                  = get_option('jcart_item_qty');
		$jcart['item_add']                  = get_option('jcart_item_add');


		// CHECKOUT PAGE
		$jcart['form_action']               = get_option('jcart_form_action');

		// PAYPAL SETUP
		$jcart['paypal_id']                 = get_option('jcart_paypal_id');
		$jcart['paypal_currency']           = get_option('jcart_paypal_currency');

		// DISPLAY TEXT
		$jcart['cart_title']                = get_option('jcart_cart_title');
		$jcart['single_item']               = get_option('jcart_single_item');
		$jcart['multiple_items']            = get_option('jcart_multiple_items');
		$jcart['subtotal']                  = get_option('jcart_subtotal');

		$jcart['update_button']             = get_option('jcart_update_button');
		$jcart['checkout_button']           = get_option('jcart_checkout_button');
		$jcart['checkout_paypal_button']    = get_option('jcart_checkout_paypal_button');
		$jcart['remove_link']               = get_option('jcart_remove_link');
		$jcart['empty_button']              = get_option('jcart_empty_button');
		$jcart['empty_message']             = get_option('jcart_empty_message');
		$jcart['item_added_message']        = get_option('jcart_item_added_message');

		$jcart['price_error']               = get_option('jcart_price_error');
		$jcart['qty_error']                 = get_option('jcart_qty_error');
		$jcart['checkout_error']            = get_option('jcart_checkout_error');

		$jcart['update_image']              = get_option('jcart_update_image');
		$jcart['empty_image']               = get_option('jcart_empty_image');
		$jcart['checkout_image']            = get_option('jcart_checkout_image');
		$jcart['checkout_paypal_image']     = get_option('jcart_checkout_paypal_image');
		}
?>

<div class="wrap" id="jcart-admin">
    <h2><a href="http://conceptlogic.com/jcart/" title="Visit the jCart website"><img src="<?php echo WP_PLUGIN_URL;?>/jcart/logo.jpg" alt="" style="vertical-align:middle;" /></a> &#8212;&nbsp;&nbsp;PayPal/Ajax shopping cart for WordPress</h2>

	<p>Thanks for testing the <strong>beta version</strong> of the jCart plugin for Wordpress!</p>

	<p>Please send feedback to: <a href="mailto:jcart@conceptlogic.com">jcart@conceptlogic.com</a></p>

	<div class="hr"><hr /></div>

	<h3>Installation</h3>

	<ol>
		<li>Copy &amp; paste the following code into your sidebar: <code>&lt;div id="jcart"&gt;&lt;?php wp_jcart($location = 'sidebar');?&gt;&lt;/div&gt;</code></li>
		<li>Copy the <strong>demo-store.php</strong> template into your theme folder, then create a new page with this template or apply it to an existing page.</li>
		<li>Copy the <strong>checkout.php</strong> template into your theme folder, then create a new page with this template or apply it to an existing page.</li>
		<li>Set the options below as necessary.</li>
	</ol>

	<div class="hr"><hr /></div>

    <form method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
        <input type="hidden" name="jcart-options-post" value="Y">

		<?php
		// CREATE NONCE
		wp_nonce_field('jcart-update-admin-options');
		?>

		<h3>PayPal Setup</h3>

		<?php

		switch($jcart['paypal_currency'])
			{
			case 'AUD':
				$selected['AUD'] = ' selected="selected"';
				break;
			case 'CAD':
				$selected['CAD'] = ' selected="selected"';
				break;
			case 'EUR':
				$selected['EUR'] = ' selected="selected"';
				break;
			case 'GBP':
				$selected['GBP'] = ' selected="selected"';
				break;
			case 'JPY':
				$selected['JPY'] = ' selected="selected"';
				break;
			case 'USD':
				$selected['USD'] = ' selected="selected"';
				break;
			case 'NZD':
				$selected['NZD'] = ' selected="selected"';
				break;
			case 'CHF':
				$selected['CHF'] = ' selected="selected"';
				break;
			case 'HKD':
				$selected['HKD'] = ' selected="selected"';
				break;
			case 'SGD':
				$selected['SGD'] = ' selected="selected"';
				break;
			case 'SEK':
				$selected['SEK'] = ' selected="selected"';
				break;
			case 'DKK':
				$selected['DKK'] = ' selected="selected"';
				break;
			case 'PLN':
				$selected['PLN'] = ' selected="selected"';
				break;
			case 'NOK':
				$selected['NOK'] = ' selected="selected"';
				break;
			case 'HUF':
				$selected['HUF'] = ' selected="selected"';
				break;
			case 'CZK':
				$selected['CZK'] = ' selected="selected"';
				break;
			case 'ILS':
				$selected['ILS'] = ' selected="selected"';
				break;
			case 'MXN':
				$selected['MXN'] = ' selected="selected"';
				break;
			}
		?>

		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="jcart-paypal-id">Secure merchant ID:</label></th>
				<td><input type="text" id="jcart-paypal-id" name="jcart-paypal-id" size="" maxlength="" value="<?php echo $jcart['paypal_id'];?>" class="regular-text" /> &nbsp;(<a href="<?php echo WP_PLUGIN_URL;?>/jcart/jcart-admin-tooltips.php?content=paypal&amp;width=450" class="thickbox">more info</a>)</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-paypal-currency">Currency:</label></th>
				<td>
					<select id="jcart-paypal-currency" name="jcart-paypal-currency">
						<option value="">Select...</option>
						<option value="AUD"<?php echo $selected['AUD'];?>>AUD - Australian Dollars</option>
						<option value="CAD"<?php echo $selected['CAD'];?>>CAD - Canadian Dollars</option>
						<option value="EUR"<?php echo $selected['EUR'];?>>EUR - Euros</option>
						<option value="GBP"<?php echo $selected['GBP'];?>>GBP - Pounds Sterling</option>
						<option value="JPY"<?php echo $selected['JPY'];?>>JPY - Yen</option>
						<option value="USD"<?php echo $selected['USD'];?>>USD - US Dollars</option>
						<option value="NZD"<?php echo $selected['NZD'];?>>NZD - New Zealand Dollar</option>
						<option value="CHF"<?php echo $selected['CHF'];?>>CHF - Swiss Franc</option>
						<option value="HKD"<?php echo $selected['HKD'];?>>HKD - Hong Kong Dollar</option>
						<option value="SGD"<?php echo $selected['SGD'];?>>SGD - Singapore Dollar</option>
						<option value="SEK"<?php echo $selected['SEK'];?>>SEK - Swedish Krona</option>
						<option value="DKK"<?php echo $selected['DKK'];?>>DKK - Danish Krone</option>
						<option value="PLN"<?php echo $selected['PLN'];?>>PLN - Polish Zloty</option>
						<option value="NOK"<?php echo $selected['NOK'];?>>NOK - Norwegian Krone</option>
						<option value="HUF"<?php echo $selected['HUF'];?>>HUF - Hungarian Forint</option>
						<option value="CZK"<?php echo $selected['CZK'];?>>CZK - Czech Koruna</option>
						<option value="ILS"<?php echo $selected['ILS'];?>>ILS - Israel Shekel</option>
						<option value="MXN"<?php echo $selected['MXN'];?>>MXN - Mexican Peso</option>
					</select>
				</td>
			</tr>
		</table>

		<div class="hr"><hr /></div>

		<h3>Checkout Page</h3>

		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="jcart-form-action">Checkout page URL:</label></th>

				<?php $protocol = 'http://'; if (!empty($_SERVER['HTTPS'])) { $protocol = 'https://'; }?>

				<td><?php echo $protocol . $_SERVER['HTTP_HOST'];?>/<input type="text" id="jcart-form-action" name="jcart-form-action" size="" maxlength="" value="<?php echo $jcart['form_action'];?>" class="regular-text" /> &nbsp;(<a href="<?php echo WP_PLUGIN_URL;?>/jcart/jcart-admin-tooltips.php?content=checkout&amp;width=450" class="thickbox">more info</a>)</td>
			</tr>
		</table>

		<div class="hr"><hr /></div>

		<h3>Field Names</h3>

		<ul>
			<li>To accept items from your store, jCart needs to know the field names used in your add-to-cart forms.</li>
			<li>Unless using the sample form included in the <strong>demo-store.php</strong> template, override the default values with your input name attributes.</li>
			<li>Your add-to-cart forms must also use the CSS class <code>jcart</code>.</li>
			<li><a href="<?php echo WP_PLUGIN_URL;?>/jcart/jcart-admin-tooltips.php?content=sample_form&amp;width=675" class="thickbox">View an example form.</a></li>
		</ul>

		<table class="form-table">
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-item-id">Item ID:</label></th>
				<td><input type="text" id="jcart-item-id" name="jcart-item-id" size="" maxlength="" value="<?php echo $jcart['item_id'];?>" class="regular-text" /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-item-name">Item name:</label></th>
				<td><input type="text" id="jcart-item-name" name="jcart-item-name" size="" maxlength="" value="<?php echo $jcart['item_name'];?>" class="regular-text" /> &nbsp;(<a href=
				"<?php echo WP_PLUGIN_URL;?>/jcart/jcart-admin-tooltips.php?content=encoding&amp;width=450" class="thickbox">using special or accented characters?</a>)</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-item-price">Item price:</label></th>
				<td><input type="text" id="jcart-item-price" name="jcart-item-price" size="" maxlength="" value="<?php echo $jcart['item_price'];?>" class="regular-text" /></td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-item-qty">Item quantity:</label></th>
				<td><input type="text" id="jcart-item-qty" name="jcart-item-qty" size="" maxlength="" value="<?php echo $jcart['item_qty'];?>" class="regular-text" /></td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-item-add">Add-to-cart:</label></th>
				<td><input type="text" id="jcart-item-add" name="jcart-item-add" size="" maxlength="" value="<?php echo $jcart['item_add'];?>" class="regular-text" /> &nbsp;(<a href=
				"<?php echo WP_PLUGIN_URL;?>/jcart/jcart-admin-tooltips.php?content=image_button&amp;width=450" class="thickbox">using an image button?</a>)</td>
			</tr>
		</table>

		<div class="hr"><hr /></div>

		<h3>Cart Text</h3>

		<ul>
			<li>Override the default cart text with your values, or leave these empty to use the defaults shown.</li>
		</ul>

		<table class="form-table">
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-cart-title">Cart title:</label></th>
				<td>
					<input type="text" id="jcart-cart-title" name="jcart-cart-title" size="" maxlength="" value="<?php echo $jcart['cart_title'];?>" class="regular-text" />
					<span class="setting-description">Shopping Cart</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-single-item">Single item:</label></th>
				<td>
					<input type="text" id="jcart-single-item" name="jcart-single-item" size="" maxlength="" value="<?php echo $jcart['single_item'];?>" class="regular-text" />
					<span class="setting-description">Item</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-multiple-items">Multiple items:</label></th>
				<td>
					<input type="text" id="jcart-multiple-items" name="jcart-multiple-items" size="" maxlength="" value="<?php echo $jcart['multiple_items'];?>" class="regular-text" />
					<span class="setting-description">Items</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-subtotal">Subtotal:</label></th>
				<td>
					<input type="text" id="jcart-subtotal" name="jcart-subtotal" size="" maxlength="" value="<?php echo $jcart['subtotal'];?>" class="regular-text" />
					<span class="setting-description">Subtotal</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-remove-link">Remove link:</label></th>
				<td>
					<input type="text" id="jcart-remove-link" name="jcart-remove-link" size="" maxlength="" value="<?php echo $jcart['remove_link'];?>" class="regular-text" />
					<span class="setting-description">remove</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-checkout-button">Checkout button:</label></th>
				<td>
					<input type="text" id="jcart-checkout-button" name="jcart-checkout-button" size="" maxlength="" value="<?php echo $jcart['checkout_button'];?>" class="regular-text" />
					<span class="setting-description">checkout</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-checkout-paypal-button">PayPal button:</label></th>
				<td>
					<input type="text" id="jcart-checkout-paypal-button" name="jcart-checkout-paypal-button" size="" maxlength="" value="<?php echo $jcart['checkout_paypal_button'];?>" class="regular-text" />
					<span class="setting-description">Checkout with PayPal</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-update-button">Update button:</label></th>
				<td>
					<input type="text" id="jcart-update-button" name="jcart-update-button" size="" maxlength="" value="<?php echo $jcart['update_button'];?>" class="regular-text" />
					<span class="setting-description">update</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-empty-button">Empty button:</label></th>
				<td>
					<input type="text" id="jcart-empty-button" name="jcart-empty-button" size="" maxlength="" value="<?php echo $jcart['empty_button'];?>" class="regular-text" />
					<span class="setting-description">empty</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-empty-message">Empty cart message:</label></th>
				<td>
					<input type="text" id="jcart-empty-message" name="jcart-empty-message" size="" maxlength="" value="<?php echo $jcart['empty_message'];?>" class="regular-text" />
					<span class="setting-description">Your cart is empty!</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-item-added-message">Item added message:</label></th>
				<td>
					<input type="text" id="jcart-item-added-message" name="jcart-item-added-message" size="" maxlength="" value="<?php echo $jcart['item_added_message'];?>" class="regular-text" />
					<span class="setting-description">Item added!</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-price-error">Price error message:</label></th>
				<td>
					<input type="text" id="jcart-price-error" name="jcart-price-error" size="" maxlength="" value="<?php echo $jcart['price_error'];?>" class="regular-text" />
					<span class="setting-description">Invalid price format!</span>
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-qty-error">Quantity error message:</label></th>
				<td>
					<input type="text" id="jcart-qty-error" name="jcart-qty-error" size="" maxlength="" value="<?php echo $jcart['qty_error'];?>" class="regular-text" />
					<span class="setting-description">Item quantities must be whole numbers!</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-checkout-error">Checkout error message:</label></th>
				<td>
					<input type="text" id="jcart-checkout-error" name="jcart-checkout-error" size="" maxlength="" value="<?php echo $jcart['checkout_error'];?>" class="regular-text" />
					<span class="setting-description">Your order could not be processed!</span>
				</td>
			</tr>
		</table>

		<div class="hr"><hr /></div>

		<h3>Cart Buttons</h3>

		<ul>
			<li>You can override the default cart buttons with your images by setting the path and filename for each image.</li>
			<li>Note that the update and empty buttons are hidden when javascript is enabled.</li>
		</ul>

		<table class="form-table">
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-update-image">Update:</label></th>
				<td>
					<input type="text" id="jcart-update-image" name="jcart-update-image" size="" maxlength="" value="<?php echo $jcart['update_image'];?>" class="regular-text" style="width:450px;" />
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-empty-image">Empty:</label></th>
				<td>
					<input type="text" id="jcart-empty-image" name="jcart-empty-image" size="" maxlength="" value="<?php echo $jcart['empty_image'];?>" class="regular-text" style="width:450px;" />
				</td>
			</tr>
			<tr valign="top" style="background:#edfbef;">
				<th scope="row"><label for="jcart-checkout-image">Checkout:</label></th>
				<td>
					<input type="text" id="jcart-checkout-image" name="jcart-checkout-image" size="" maxlength="" value="<?php echo $jcart['checkout_image'];?>" class="regular-text" style="width:450px;" />
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="jcart-checkout-paypal-image">PayPal checkout:</label></th>
				<td>
					<input type="text" id="jcart-checkout-paypal-image" name="jcart-checkout-paypal-image" size="" maxlength="" value="<?php echo $jcart['checkout_paypal_image'];?>" class="regular-text" style="width:450px;" />
				</td>
			</tr>
		</table>

		<div class="hr"><hr /></div>

		<p class="submit">
			<input type="submit" name="jcart-options-update" value="<?php _e('Save jCart Options', '') ?>" class="button-primary" />
		</p>
	</form>

</div>

<?php
	} // END JCART ADMIN OPTIONS
?>
